﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Single.Npoi
{
    public class NpoiMap<T>
    {
        Dictionary<string, NpoiMapNode<T>> maps;

        public List<string> Keys
        {
            get { return maps.Keys.ToList(); }
        }
        public List<NpoiMapNode<T>> Values
        {
            get { return maps.Values.ToList(); }
        }

        public NpoiMap()
        {
            maps = new Dictionary<string, NpoiMapNode<T>>();
        }

        public void Add(string name, Expression<Func<T, object>> expr, bool required = false, int width = 0)
        {
            maps.Add(name, new NpoiMapNode<T>(name, expr, required, width));
        }
    }
}